package 牛客_面试必刷.Month07.day10;

public class 对称二叉树 {
    boolean isSymmetrical(TreeNode pRoot) {
        if(pRoot == null) return true;
        return solve(pRoot.left,pRoot.right);
    }

    public boolean solve(TreeNode root1,TreeNode root2){
        if(root1 == null && root2 == null) return true;
        if(root1 == null || root2 == null) return false;
        if(root1 .val == root2.val){
            return solve(root1.left,root2.right) && solve(root1.right,root2.left);
        }
        return false;
    }
}
